from google.appengine.ext import db
from google.appengine.api import memcache
from user import *

class YTComment(db.Model):
    category = db.StringProperty(multiline=False)
    ref = db.ReferenceProperty(collection_name='ytcomment_ref_set') 
    ext = db.ReferenceProperty(collection_name='ytcomment_ext_set') 
  
    author = db.ReferenceProperty(YTUser)
    date = db.DateTimeProperty(auto_now_add=True)
    content = db.TextProperty()

    def get_parent(self):
        if db.get(YTComment.ref.get_value_for_datastore(self.ref)):
            return self.ref
        return None

    def get_owner(self):
        return self.author
    